package com.sphd.restaurantsystem.model;


import com.android.volley.VolleyError;
import com.sphd.restaurantsystem.interfaces.VolleyJsonObjectCallBack;
import com.sphd.restaurantsystem.presenter.SetFudingPresenter;

import org.json.JSONException;
import org.json.JSONObject;

/**
* Created by Hu on 2016/11/03
*/

public class SetFudingModelImpl implements SetFudingModel, VolleyJsonObjectCallBack {
    SetFudingPresenter setFudingPresenter;
    @Override
    public void sendUrl(String url, SetFudingPresenter setFudingPresenter) {
        volleyUtil.setJsonObjectRequest(url,this);
    }

    @Override
    public void onResponse(JSONObject response) {
        try {
            int res=response.getInt("res");
            setFudingPresenter.sendRes(res);
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void onErrorResponse(VolleyError error) {
setFudingPresenter.sendError(error);
    }
}